<?php

namespace frontend\models\artide;

use Yii; 

/**
 * This is the model class for table "sql_practice".
 *
 * @property integer $id
 * @property string $imgurl
 * @property integer $status
 * @property integer $flag
 */
class SqlPractice extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sql_practice';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['status', 'flag'], 'integer'],
            [['imgurl'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'imgurl' => 'Imgurl',
            'status' => 'Status',
            'flag' => 'Flag',
        ];
    }

    // 更新数据
    public function changeDate($data){
        // print_r($data['imgurl']);
        // echo $this->imgurl;
        // echo $this->status;
         $this->imgurl=$data['imgurl'];
         $this->status=$data['status'];
         $this->flag=$data['flag'];
         $this->save();
        return true;
    }


}
